//
//  MBaseService.m
//  NeusoftHBSJSober
//
//  Created by Apple-21 on 15/10/28.
//  Copyright (c) 2015年 com.neusoftsober. All rights reserved.
//

#import "MBaseService.h"

@implementation MBaseService
+ (id)sharedHTTPClient {
    
    AFHTTPClient *shared_instance;
    shared_instance = [AFHTTPClient clientWithBaseURL:[NSURL URLWithString:BASE_SERVER_URL]];
    [shared_instance registerHTTPOperationClass:[AFJSONRequestOperation class]];
    [shared_instance setDefaultHeader:@"Accept" value:@"application/json"];
    
    shared_instance.parameterEncoding = AFJSONParameterEncoding;
    return shared_instance;
}

+ (id)sharedClient {
    
    static dispatch_once_t pred;
    static MBaseService *shared_instance = nil;
    
    dispatch_once (&pred,^{
        
        shared_instance = [[self alloc]init];
        shared_instance.client = [self sharedHTTPClient];
    });
    
    return shared_instance;
}
@end
